const Mock = require('mockjs')

const listTemplate = {
  'records|15': [
    {
      id: '@increment',
      breed_place: '@region',
      'weight|100-250.3': 1,
      'sex|1': ['1', '2'],
      'traits|1': ['黑白花', '白', '粉', '彩'],
      'check_status|1': ['0', '1'],
      check_id: '@guid',
      out_date: '@datetime'
    }
  ],
  total: 224
}
const cutTemplate = {
  'records|3-8': [
    {
      'weight|100-250.3': 1,
      'part_name|1': ['猪蹄', '猪肘', '五花', '猪心', '猪肠']
    }
  ]
}

module.exports = [
  {
    url: '/pig/addpig',
    type: 'post',
    response: config => {
      // console.log(config)
      return {
        code: 200
      }
    }
  },
  {
    url: '/pig/getcutinfo',
    type: 'post',
    response: config => {
      // console.log(config)
      return {
        code: 200,
        obj: Mock.mock(cutTemplate)
      }
    }
  },
  {
    url: '/pig/cut',
    type: 'post',
    response: config => {
      console.log(config)
      return {
        code: 200
      }
    }
  },
  {
    url: '/pig/list',
    type: 'post',
    response: config => {
      // console.log(config)
      return {
        code: 200,
        obj: Mock.mock(listTemplate)
      }
    }
  }
]
